return normal_exit
-
-def restore_gnome():
- # Do imports lazily to save time and memory
- import gio
- import gconf
-
- # We don't want to start the new gnome-panel in the current
- # directory; $HOME is better for stuff launched from it
- os.chdir(os.path.expanduser("~"))
-
- def launch_component(gconf_path):
- client = gconf.client_get_default()
- component = client.get_string(gconf_path)
-
- if component == None or component == "":
- return False
-
- # See gnome-session/gsm-util.c:gsm_util_find_desktop_file_for_app_name()
- # The one difference is that we don't search the autostart directories,
- # and just search normal application search path. (Gio doesnt' know
- # how to search the autostart dirs, so we'd have to do that ourselves.)
- appinfo = None
- try:
- appinfo = gio.unix.DesktopAppInfo(component + ".desktop")
- except:
- try:
- appinfo = gio.unix.DesktopAppInfo("gnome-" + component + ".desktop")
- except:
- pass
-
- if appinfo:
- appinfo.launch()
- return True
- return False
-
- # GNOME2 fallback
- wm = launch_component("/desktop/gnome/session/required_components/windowmanager")
- panel = launch_component("/desktop/gnome/session/required_components/panel")
-
- if not wm and not panel: # Probably GNOME3
- subprocess.Popen(['gnome-shell'])
-
# Main program
parser = optparse.OptionParser()
elif options.debug:
options.debug_command = "gdb --args"
-# We only respawn the previous environment on abnormal exit;
-# for a clean exit, we assume that gnome-shell was replaced with
-# something else.
-normal_exit = False
-
-try:
- normal_exit = run_shell()
-finally:
- if options.replace and not normal_exit:
- restore_gnome()
-
+normal_exit = run_shell()
if normal_exit:
sys.exit(0)
else: